package com.clementheliou.cheliou.util.math.average;

import java.io.Serializable;

import org.apache.commons.lang3.builder.EqualsBuilder;

/**
 * Represents an average mark.
 * 
 * @author Clément HELIOU (clement.heliou@gmail.com)
 * @see {@link Serializable}.
 * @since 1.0
 */
public class AverageMark implements Serializable {

	/**
	 * UID for serialization.
	 * 
	 * @author Clément HELIOU (clement.heliou@gmail.com)
	 * @since 1.0
	 */
	private static final long serialVersionUID = 1332171229882349315L;

	/**
	 * The average mark's value.
	 * 
	 * @author Clément HELIOU (clement.heliou@gmail.com)
	 * @since 1.0
	 */
	private Double value;

	/**
	 * The number of marks used to calculate the average.
	 * 
	 * @author Clément HELIOU (clement.heliou@gmail.com)
	 * @since 1.0
	 */
	private Integer marksNumber;

	/**
	 * Constructor from the given value and mark's number.
	 * 
	 * @author Clément HELIOU (clement.heliou@gmail.com)
	 * @param value the value to be used.
	 * @param marksNumber the number to be used.
	 * @since 1.0
	 */
	public AverageMark(Double value, Integer marksNumber) {
		this.value = value;
		this.marksNumber = marksNumber;
	}

	/*
	 * Getters & setters.
	 */
	public Double getValue() {
		return value;
	}

	public void setValue(Double value) {
		this.value = value;
	}

	public Integer getMarksNumber() {
		return marksNumber;
	}

	public void setMarksNumber(Integer marksNumber) {
		this.marksNumber = marksNumber;
	}

	/**
	 * <i>{@inheritDoc}</i>
	 * 
	 * @author Clément HELIOU (clement.heliou@gmail.com)
	 * @since 1.0
	 */
	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(obj, this, false);
	}

}
